#include "pch.h"
#include "PropertyValueOwner.h"
//#include <wrl\client.h>
#include <wrl\wrappers\corewrappers.h>
//#include <Windows.h>
//#include <roapi.h>
#include <windows.foundation.h>  

//namespace ABI {
	namespace Yinyue200 {
		namespace CppWrapper {
			PropertyValueOwner::PropertyValueOwner()
			{
				Microsoft::WRL::Wrappers::HStringReference stringActivableClassId(RuntimeClass_Windows_Foundation_PropertyValue);
				ABI::Windows::Foundation::GetActivationFactory(stringActivableClassId.Get(), &m_propertyValueFactory);

			}

			int64 PropertyValueOwner::GetFactoryPointer()
			{
				ABI::Windows::Foundation::IPropertyValueStatics *b = nullptr;
				ABI::Windows::Foundation::IPropertyValueStatics** a = &b;
				m_propertyValueFactory.CopyTo(a);
				return (int64)b;
			}
			int64 PropertyValueOwner::CreateUInt32(UINT value) {
				IInspectable *b = nullptr;
				IInspectable** iinb = &b;
				this->m_propertyValueFactory->CreateUInt32(value,iinb);
				auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
				autoptr->CopyTo(iinb);
				return (int64)b;
			}
			int64 PropertyValueOwner::CreateInt32(int value) {
				IInspectable *b = nullptr;
				IInspectable** iinb = &b;
				this->m_propertyValueFactory->CreateInt32(value, iinb);
				auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
				autoptr->CopyTo(iinb);
				return (int64)b;
			}
			int64 PropertyValueOwner::CreateSingle(float value) {
				IInspectable *b = nullptr;
				IInspectable** iinb = &b;
				this->m_propertyValueFactory->CreateSingle(value, iinb);
				auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
				autoptr->CopyTo(iinb);
				return (int64)b;
			}
			int64 PropertyValueOwner::CreateBoolean(bool value) {
				IInspectable *b = nullptr;
				IInspectable** iinb = &b;
				this->m_propertyValueFactory->CreateBoolean(value, iinb);
				auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
				autoptr->CopyTo(iinb);
				return (int64)b;
			}
			int64 PropertyValueOwner::CreateSingleArray(const Platform::Array<float>^ value) {
				IInspectable *b = nullptr;
				IInspectable** iinb = &b;
				this->m_propertyValueFactory->CreateSingleArray(value->Length,&value[0], iinb);
				auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
				autoptr->CopyTo(iinb);
				return (int64)b;
			}
			//int PropertyValueOwner::CreateIInspectable(IInspectable* value) {
			//	IInspectable *b = nullptr;
			//	IInspectable** iinb = &b;
			//	this->m_propertyValueFactory->CreateInspectable(value, iinb);
			//	auto autoptr = new Microsoft::WRL::ComPtr<IInspectable>(*iinb);
			//	autoptr->CopyTo(iinb);
			//	return (int)b;
			//}

			//ComPtr<IPropertyValue> PropertyValueOwner::CreatePropertyValue(int value)
			//{
			//	void* ptr = &value;
			//	return CreateProperty(this->m_propertyValueFactory, new Microsoft::WRL::ComPtr<IInspectable>(*value));
			//}
			//ABI::Windows::Foundation::IPropertyValue& CreateInt32(int value) {

			//}
			//ABI::Windows::Foundation::IPropertyValue& CreateSingle(float value) {
			//}
			//ABI::Windows::Foundation::IPropertyValue& CreateInspectable(Platform::Object value) {

			//}
			//ABI::Windows::Foundation::IPropertyValue& CreateBoolean(bool value) {

			//}
		}
	}
//}

